package core.enums;

import lombok.Getter;

@Getter
public enum ResultCode {
    SUCCESS(200, "操作成功"), // 成功
    FAILED(300, "操作异常"),  // 系统错误
    ERROR(500, "服务器繁忙, 请稍后再试"), // 业务错误

    FAILED_UNAUTHORIZED (301, "未授权"),
    FAILED_PARAMS_VALIDATE (302, "参数校验失败"),
    FAILED_NOT_EXISTS (303, "资源不存在"),
    FAILED_ALREADY_EXISTS (304, "资源已存在"),
    AILED_USER_EXISTS (311, "用户已存在"),
    FAILED_USER_NOT_EXISTS (312, "用户不存在"),
    FAILED_LOGIN (313, "用户名或密码错误"),
    FAILED_USER_BANNED (314, "你已被列入黑名单, 请联系管理员."),
    FAILED_FREQUENT (315, "操作频繁, 请稍候重试"),
    FAILED_CODE_TIMES_LIMIT (316, "获取验证码次数超出限制"),
    FAILED_CODE_SEND_ERROR(317, "验证码发送失败"),
    FAILED_CODE_INVALID(318, "验证码错误或已过期"),

    PHONE_ERROR(319, "手机号码格式错误"),

    EXAM_START_TIME_BEFORE_NOW(305, "开始时间不能早于当前时间"),
    EXAM_START_TIME_AFTER_START_TIME(306, "结束时间不能早于开始时间"),
    EXAM_NOT_EXISTS(307, "竞赛不存在"),
    EXAM_QUESTION_NOT_EXISTS(308, "竞赛所对应题目不存在"),
    EXAM_STARTED(309, "竞赛已开始, 不能操作"),
    EXAM_NOT_HAS_QUESTION(310, "竞赛中没有题目"),
    EXAM_FINISHED(320, "竞赛已结束, 不能操作"),
    EXAM_PUBLISHED(321, "竞赛已发布, 不能操作"),

    USER_REP_APPLY(331, "无需重复报名"),

    FAILED_FILE_UPLOAD_TIME_LIMIT(340, "今日上传文件次数超过限制"),
    FAILED_FILE_UPLOAD(341, "文件上传失败"),

    FIRST_QUESTION(350, "当前已经是第一题了"),
    LAST_QUESTION(351, "当前已经是最后一题了"),

    PROGRAM_LANGUAGE_NOT_SUPPORT(360, "不支持的编程语言"),

    FAIL_RABBITMQ_PRODUCE(370, "RabbitMQ消息发送失败"),
    ;
    private Integer code;
    private String message;
    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}
